<html xmlns:th="http://www.thymeleaf.org" xmlns:x="http://www.w3.org/1999/html">
<div class="easyui-layout" data-options="fit:true,border:false">
    <div data-options="region:'center',border:false" title="" style="overflow: hidden;padding: 3px;">
        <form id="houseEditForm" method="post">
            <table class="grid">
                <input name="id" type="hidden" th:value="${house.id}">
                <tr>
                    <td></td>
                    <td><input name="id" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.id}"></td>
                    <td></td>
                    <td><input name="beautiful" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.beautiful}"></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input name="consuming1" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.consuming1}"></td>
                    <td></td>
                    <td><input name="consuming2" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.consuming2}"></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input name="consuming3" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.consuming3}"></td>
                    <td></td>
                    <td><input name="consuming4" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.consuming4}"></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input name="description2" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.description2}"></td>
                    <td></td>
                    <td><input name="displayName" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.displayName}"></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input name="distance1" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.distance1}"></td>
                    <td></td>
                    <td><input name="distance2" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.distance2}"></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input name="distance3" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.distance3}"></td>
                    <td></td>
                    <td><input name="distance4" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.distance4}"></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input name="location" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.location}"></td>
                    <td></td>
                    <td><input name="mobile" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.mobile}"></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input name="phone" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.phone}"></td>
                    <td></td>
                    <td><input name="size" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.size}"></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input name="time" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.time}"></td>
                    <td></td>
                    <td><input name="totalPrice" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.totalPrice}"></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input name="typee" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.typee}"></td>
                <tr>
                    <td></td>
                    <td><input name="unitPrice" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${house.unitPrice}"></td>
                </tr>
            </table>
            </table>
        </form>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $('#houseEditForm').form({
            url: basePath + '/house/edit',
            onSubmit: function () {
                progressLoad();
                var isValid = $(this).form('validate');
                if (!isValid) {
                    progressClose();
                }
                return isValid;
            },
            success: function (result) {
                progressClose();
                result = $.parseJSON(result);
                if (result.code === 1) {
                    //之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为list页面预定义好了
                    parent.$.modalDialog.openner_dataGrid.datagrid('reload');
                    parent.$.modalDialog.handler.dialog('close');
                } else {
                    var form = $('#houseEditForm');
                    parent.$.messager.alert('错误', result.msg, 'error');
                }
            }
        });

        $("#houseEditStatus").val('[[${house.status}]]');
    });
</script>
